package com.libre.event;

import javafx.event.EventHandler;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.DragEvent;
import javafx.scene.input.TransferMode;

import java.util.Map;

/**
 * NOTE 文件拖到控件上方事件
 */
public class DragOverEvent implements EventHandler<DragEvent> {

    private TableView<Map<String, Object>> table = new TableView<>();

    public DragOverEvent(TableView<Map<String, Object>> table) {
        this.table = table;
    }

    public void handle(DragEvent event) {
        if (event.getGestureSource() != table) {
            event.acceptTransferModes(TransferMode.ANY);
        }
    }
}

